import Mock from 'mockjs';
import { baseApi } from '@/server/base'

export default [
  // getCurrentShift
  {
    url: `${baseApi}/api/apk/shift`,
    type: 'get',
    response: () => {
      return {
        code: 200,
        data: {
          id: '72',
          date: '2023-03-13',
          day: 'B',
          night: 'A',
          week: 'WW:11',
          quarter: '',
          year: '2023',
          shift: {
            date: '2023-03-13',
            shift: 'B',
            week: 'WW:11',
            start: '2023-03-13 07:00:00',
            end: '2023-03-13 18:59:59',
            start_time: 1678662000
          }
        },
        msg: ''
      }
    }
  },
  // getJamMethodInfo
  {
    url: /\/apis\/api\/apk\/configs\/  [?]code[=].*`/,
    type: 'get',
    response: () => {
      return {
        code: 200,
        data: [
          {
            id: '1',
            code: 'Shuttle L/R Pin1 Error',
            info: '',
            created_at: '2023-01-31 14:28:30',
            updated_at: '2023-01-31 14:28:30',
            problems: [
              {
                id: '5',
                jam_id: '1',
                type: 'Problem',
                option_type: '1',
                content: '左边shuttle PIN1 CCD判断fail',
                sort: '0',
                used: '0',
                created_at: '2023-01-31 14:28:30',
                updated_at: '2023-01-31 14:28:30'
              },
              {
                id: '6',
                jam_id: '1',
                type: 'Problem',
                option_type: '1',
                content: '产品色彩或反光亮度差别太大',
                sort: '1',
                used: '0',
                created_at: '2023-01-31 14:28:30',
                updated_at: '2023-01-31 14:36:08'
              },
              {
                id: '7',
                jam_id: '1',
                type: 'Problem',
                option_type: '1',
                content: '摄像头不是同一型号',
                sort: '2',
                used: '0',
                created_at: '2023-01-31 14:28:30',
                updated_at: '2023-01-31 14:36:08'
              }
            ],
            methods: [
              {
                id: '1',
                jam_id: '1',
                type: 'Method',
                option_type: '1',
                content: '调整CCD清晰度，重新选择比较明显的判断点和校准（GPU 3个点）',
                sort: '0',
                used: '0',
                created_at: '2023-01-31 14:28:30',
                updated_at: '2023-01-31 14:28:30'
              },
              {
                id: '3',
                jam_id: '1',
                type: 'Method',
                option_type: '1',
                content: 'PIN 无法保存或选择不上，需重启软件或PC',
                sort: '1',
                used: '0',
                created_at: '2023-01-31 14:28:30',
                updated_at: '2023-01-31 14:36:53'
              },
              {
                id: '4',
                jam_id: '1',
                type: 'Method',
                option_type: '1',
                content: '清晰度及分辨率依然达不到要求的，更换摄像头',
                sort: '2',
                used: '0',
                created_at: '2023-01-31 14:28:30',
                updated_at: '2023-01-31 14:36:53'
              },
              {
                id: '2',
                jam_id: '1',
                type: 'Method',
                option_type: '1',
                content: '特殊情况下降低识别判断值，需要具体调试，目前是80%',
                sort: '3',
                used: '0',
                created_at: '2023-01-31 14:28:30',
                updated_at: '2023-01-31 14:36:53'
              }
            ]
          }
        ],
        msg: ''
      }
    }
  },
  /**
   * 获取首页任务统计
   */
  {
    url: `${baseApi}/api/apk/tasks/num`,
    type: 'get',
    response: () => {
      return {
        code: 200,
        data: Mock.mock({
          "pending|1-100": 0,
          "running|1-100": 0,
          "cancel|1-100": 0,
          "completed|1-100": 0
        }),
        msg: ''
      }
    }
  },
  /**
   * 根据日期获取 task任务
   */
  {
    url: /\/apis\/api\/apk\/tasks\/calendar[?]date[=].*/,
    type: 'get',
    response: () => {
      return {
        code: 200,
        data: [
          {
            hour: '07:00',
            lists: [
              {
                received_by: '441343',
                received_at: '2022-12-21 07:50:00',
                completed_by: '441343',
                completed_at: '2022-12-21 07:55:00',
                canceled_by: null,
                canceled_at: null,
                updated_at: '2022-12-21 07:50:00',
                cell: 'SUZAMDASLT110',
                machine: 'ASLT110',
                block: 'B2',
                type: 'JAM',
                prod: null,
                created_by: null,
                urgent: 1,
                tag: null,
                state: 3,
                created_at: '2022-12-21 07:40:00',
                start: '07:40',
                end: '07:50',
                id: '10'
              }
            ]
          },
          {
            hour: '08:00',
            lists: [
              {
                received_by: '441343',
                received_at: '2022-12-21 08:40:00',
                completed_by: null,
                completed_at: null,
                canceled_by: null,
                canceled_at: null,
                updated_at: '2022-12-21 08:40:00',
                cell: 'SUZAMDASLT100',
                machine: 'ASLT100',
                block: 'B2',
                type: 'JAM',
                prod: null,
                created_by: null,
                urgent: 1,
                tag: null,
                state: 2,
                created_at: '2022-12-21 07:40:00',
                start: '07:40',
                end: '08:40',
                id: '11'
              }
            ]
          },
          {
            hour: '09:00',
            lists: []
          },
          {
            hour: '10:00',
            lists: []
          },
          {
            hour: '11:00',
            lists: [
              {
                received_by: null,
                received_at: null,
                completed_by: null,
                completed_at: null,
                canceled_by: '441343',
                canceled_at: '2022-12-21 11:50:00',
                updated_at: '2022-12-21 11:50:00',
                cell: 'SUZAMDASLT120',
                machine: 'ASLT120',
                block: 'B2',
                type: 'JAM',
                prod: null,
                created_by: null,
                urgent: 0,
                tag: null,
                state: 4,
                created_at: '2022-12-21 07:40:00',
                start: '07:40',
                end: '11:50',
                id: '12'
              }
            ]
          },
          {
            hour: '12:00',
            lists: []
          },
          {
            hour: '13:00',
            lists: []
          },
          {
            hour: '14:00',
            lists: []
          },
          {
            hour: '15:00',
            lists: []
          },
          {
            hour: '16:00',
            lists: []
          },
          {
            hour: '17:00',
            lists: [
              {
                received_by: null,
                received_at: null,
                completed_by: null,
                completed_at: null,
                canceled_by: '441343',
                canceled_at: '2022-12-21 17:50:00',
                updated_at: '2022-12-21 17:50:00',
                cell: 'SUZAMDASLT130',
                machine: 'ASLT130',
                block: 'B2',
                type: 'JAM',
                prod: null,
                created_by: null,
                urgent: 0,
                tag: null,
                state: 3,
                created_at: '2022-12-21 07:40:00',
                start: '07:40',
                end: '17:50',
                id: '13'
              }
            ]
          },
          {
            hour: '18:00',
            lists: []
          },
          {
            hour: '19:00',
            lists: []
          },
          {
            hour: '20:00',
            lists: []
          },
          {
            hour: '21:00',
            lists: []
          },
          {
            hour: '22:00',
            lists: []
          },
          {
            hour: '23:00',
            lists: []
          },
          {
            hour: '00:00',
            lists: []
          },
          {
            hour: '01:00',
            lists: []
          },
          {
            hour: '02:00',
            lists: []
          },
          {
            hour: '03:00',
            lists: []
          },
          {
            hour: '04:00',
            lists: []
          },
          {
            hour: '05:00',
            lists: []
          },
          {
            hour: '06:00',
            lists: []
          }
        ],
        msg: ''
      }
    }
  },
  /**
   * 获取任务详情
   * @param id
   */
  {
    url: /\/apis\/api\/apk\/tasks\/show\/[0-9]*/,
    type: 'get',
    response: () => {
      return {
        code: 200,
        data: {
          id: '20',
          mcr_id: '215',
          type: 'Jam',
          block: null,
          prod: 'C437_D202SL_EFUSE',
          location: '{"block":null,"x":"1","y":"6"}',
          machine: 'SUZAMDASLT114',
          short: 'ASLT114',
          contents: {
            id: '215',
            jam: 'No 4  Tester socket IC put jam',
            category: 'position',
            qty: '23',
            days: '1',
            rate: '1.92',
            goal: null,
            gth_goal: '1.92'
          },
          urgent: '1',
          tags: null,
          shift: 'B',
          start: '2023-02-22 07:00:00',
          end:'2023-3-14 09:39:25',
          week: 'WW:08',
          date: '2023-02-22',
          publish_by: 'test',
          publish_at: '2023-02-22 09:22:06',
          owner_id: '101323',
          owner: 'deng,xiaowei',
          transfer_owner: null,
          transfer_owner_id: null,
          transfer_apply_at: null,
          transferd_by: null,
          transfer_pid: null,
          state: '3',
          completed_at: '2023-02-22 16:41:50',
          jam_method: [
            'offset\u8c03\u6574shuttle\u5438\u4ea7\u54c1X/Y',
            '\u68c0\u67e5\u5149\u7ea4\u653e\u5927\u5668\u548csocket sensor\u7ebf \u662f\u5426\u6709\u5e72\u6270'
          ],
          jam_method_other: 'other_method',
          reject_img_id: null,
          cancel_at: null,
          cancel_reason_other: null,
          cancel_reason: null,
          cancel_state: null,
          cancel_img_id: null,
          reject_reason: null,
          canceled_at: null,
          canceled_by: null,
          score: '0',
          system_state: '2',
          accepted_at: '2023-02-22 16:23:18',
          created_at: '2023-02-22 09:22:06',
          updated_at: '2023-02-22 16:41:50',
          file_id: null,
          deleted_at: null,
          deleted_by: null,
          deleted_reason: null,
          cancel_images: [],
          task_files: []
        },
        msg: ''
      }
    }
  },
  /**
   * 上传图片路径
   */
  {
    url: `${baseApi}/api/apk/upload`,
    type: 'post',
    response: () => {
      return {
        code: 200,
        data: {
          user: '',
          disk: 'uploads',
          path: 'APK/46c1349380ea14aa3b4c1586e200d8be.docx',
          file_name: '46c1349380ea14aa3b4c1586e200d8be.docx',
          size: 657462,
          format_size: '642.05 kb',
          original_name: 'apk  问题.docx',
          module: 'APK',
          updated_at: '2023-03-07 14:23:03',
          created_at: '2023-03-07 14:23:03',
          id: 130699
        },

        msg: ''
      }
    }
  }
]
